<template>
  <div>
    <!-- 下拉菜单 -->
    <van-dropdown-menu>
      <van-dropdown-item disabled title="全部" />
      <van-dropdown-item
        v-model="value1"
        :options="option1"
        title="价格"
        @change="changeprice"
      />
      <van-dropdown-item
        v-model="value2"
        :options="Seach1Arr"
        title="分类"
        @change="changekind"
      />
    </van-dropdown-menu>
  </div>
</template>

<script>
export default {
  name: "Seach1",
  props: ["Seach1Arr"],
  data() {
    return {
      value1: 0,
      //  value2:0,
      option1: [
        { text: "由高到低", value: 'desc' },
        { text: "由低到高", value: 'asc' },
      ],
      // option2: [
      //   { text: "默认排序", value: "a" },
      //   { text: "好评排序", value: "b" },
      //   { text: "销量排序", value: "c" },
      // ],
    };
  },
  computed: {
    value2: {
      get() {
        let id = 0;
        this.Seach1Arr.forEach((item) => {
          if (item.checked) {
            id = item.value;
          }
        });
        return id;
      },
      set(val) {},
    },
  },
  methods: {
    //切换价格高低
    changeprice(val) {
      //console.log(val);
      this.$emit('trans',val)
    },
    // 切换类别
    changekind(val) {
      //console.log(val);
      this.$emit('texs',val)

    },
  },
};
</script>

<style scope>
</style>
